import api from './index'
import { axios } from '@/utils/request'
import { getAction } from '@api/manage'


export function titleList(parameter) {
  return axios({
    url: '/sys/website/sysTitle/list',
    method: 'get',
    data: parameter
  })
}

export function titleAdd(parameter) {
  return axios({
    url: '/sys/website/sysTitle/add',
    method: 'post',
    data: parameter
  })
}



export function titleEdit(parameter) {
  return axios({
    url: '/sys/website/sysTitle/edit',
    method: 'post',
    data: parameter
  })
}

export function titleDelete(parameter) {
  return axios({
    url: '/sys/website/sysTitle/delete',
    method: 'delete',
    params: parameter
  })
}




export function titleQueryByid(parameter) {
  return axios({
    url: '/sys/website/sysTitle/queryById',
    method: 'get',
    params: parameter
  })
}




export function getSmsCaptcha(parameter) {
  return axios({
    url: api.SendSms,
    method: 'post',
    data: parameter
  })
}


export function logout(logoutToken) {
  return axios({
    url: '/sys/logout',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8',
      'X-Access-Token':  logoutToken
    }
  })
}

/**
 * 第三方登录
 * @param token
 * @param thirdType
 * @returns {*}
 */
export function thirdLogin(token,thirdType) {
  return axios({
    url: `/sys/thirdLogin/getLoginUser/${token}/${thirdType}`,
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 强退其他账号
 * @param token
 * @returns {*}
 */
export function forceLogout(parameter) {
  return axios({
    url: '/sys/online/forceLogout',
    method: 'post',
    data: parameter
  })
}


export function queryDepartTreeList(params) {
  return axios({
    url: '/sys/website/sysTitle/queryTreeList',
    method: 'get',
    data: params
  })
}

const queryIdTree = (params)=>getAction("/sys/website/sysTitle/queryIdTree",params);



